using Dapper.Extensions;

namespace Dapper.SqlServer;

/// <summary>
/// SQL Server 数据库扩展方法
/// </summary>
public static class DapperBuilderExtensions
{
    /// <summary>
    /// 配置使用 SQL Server 数据库
    /// </summary>
    /// <param name="builder">Dapper 构建器</param>
    /// <param name="connectionString">SQL Server 连接字符串</param>
    /// <returns>Dapper 构建器</returns>
    public static DapperBuilder UseSqlServer(this DapperBuilder builder, string connectionString)
    {
        builder.Options.ConnectionString = connectionString;
        builder.Options.ConnectionFactoryStrategy = new SqlServerConnectionFactoryStrategy();
        builder.Options.SqlCompilerStrategy = new SqlServerCompilerStrategy();
        return builder;
    }
}
